package cn.gjxblog.service.impl;

import cn.gjxblog.dao.UserDAO;
import cn.gjxblog.entity.Permission;
import cn.gjxblog.entity.Role;
import cn.gjxblog.entity.User;
import cn.gjxblog.service.UserSerivce;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * 作用:
 * 作者:gjx
 * 版本:V1.0
 * 创建时间: 2018/7/29 20:04
 */
@Service
@Transactional
public class UserServiceImpl implements UserSerivce {

    @Resource
    private UserDAO userDAO;

    @Override
    public User findUserByName(String username) {
        User userByName = userDAO.findUserByName(username);
        return userByName;
    }

    @Override
    public List<Role> findRoles(String username) {
        List<Role> roles = userDAO.findRoles(username);
        return roles;
    }

    @Override
    public List<Permission> findPermissions(String username) {
        List<Permission> permissions = userDAO.findPermissions(username);
        return permissions;

    }
}
